import { createRouter, createWebHistory } from "vue-router";
import { routes } from "./routerConfig";
let pateTitle = ref('')
const router = createRouter({
  history: createWebHistory(),
  routes,
});
router.beforeEach(async (to: any, from, next) => {
  window.$loadingBar.start();
  pateTitle.value = to.meta.title;
  next();
});
router.afterEach(() => {
  window.$loadingBar.finish();
});
router.onError(() => {
  window.$loadingBar.error();
});

export default router;
export {
  pateTitle
}
